<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
    <title>ShellCheck: SC2040 – `#!/bin/sh` was specified, so ____ is not supported, even when sh is actually bash.</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
  </head>
  <body style="margin-left: auto; margin-right: auto; max-width: 800px">
    <h1>SC2040 – ShellCheck Wiki</h1>
    <a href="https://github.com/koalaman/shellcheck/wiki/SC2040">See this page on GitHub</a>
    <p style="display: none"><a href="index.html">Sitemap</a></p>
    <hr />
    <h2
id="binsh-was-specified-so-____-is-not-supported-even-when-sh-is-actually-bash"><code>#!/bin/sh</code>
was specified, so ____ is not supported, even when sh is actually
bash.</h2>
<p>The shebang indicates that the script works with
<code>/bin/sh</code>, but you are using non-standard features that may
not work with <code>/bin/sh</code>, <strong>even if /bin/sh is actually
bash</strong>. Bash behaves differently when invoked as <code>sh</code>,
and disabling support for the highlighted feature is one part of
that.</p>
<p>Specify <code>#!/usr/bin/env bash</code> to ensure that bash (or your
shell of choice) will be used, or rewrite the script to be more
portable.</p>
<p>The Ubuntu wiki has <a href="https://wiki.ubuntu.com/DashAsBinSh">a
list of portability issues</a> and suggestions on how to rewrite
them.</p>
    <hr />
    <p style='font-size: 80%'><a href="../index.html">ShellCheck</a> is a static analysis tool for shell scripts. This page is part of its documentation.</p>
  </body>
</html>


